{% macro show_a_comment(comment) %}
    <div class="panel panel-default">
        <ul class="list-group">
            <li class="list-group-item">
                <div class="panel-heading">
                    <label class="text-primary">{{ comment.name }}</label> 说 ：
                    <span class='pull-right text-muted h6'>评论日期：{{ comment.timestamp }}</span>
                </div>
                <div class="panel-body">
                    <label class="text-primary">{{ comment.comment|safe }}</label>
                    <a class="pull-right" data-toggle="modal"
                       data-target="#exampleModal"
                       data-whatever="{{ comment.name|string+'|'+comment.id|string }}">回复</a>
                </div>
            </li>
        </ul>
    </div>
{% endmacro %}

{% macro show_footer(comments) %}
    {% for c in comments %}
        {% if is_list(c) %}
            <div class="panel panel-default">
                <ul class="list-group">
                    <li class="list-group-item">
                        <div class="panel-heading">
                            <label class="text-primary">{{ c[0].name }}</label> 说 ：
                            <span class='pull-right text-muted h6'>评论日期：{{ c[0].timestamp }}</span>
                        </div>
                        <div class="panel-body">
                            <label class="text-primary">{{ c[0].comment|safe }}</label>
                            <a class="pull-right" data-toggle="modal"
                               data-target="#exampleModal"
                               data-whatever="{{ c[0].name|string+'|'+c[0].id|string }}">回复</a>
                        </div>
                        {% if c[1] %}
                            {{ show_footer(c[1]) }}
                        {% endif %}
                    </li>
                </ul>
            </div>
        {% else %}
            {{ show_a_comment(c) }}
        {% endif %}
    {% endfor %}
{% endmacro %}

{% macro show_comments(comments) %}
    {% if not comments %}
        <ul class="list-group">
            <li class="list-group-item list-group-item-text">
                <div class="panel-body bg-warning">暂无</div>
            </li>
        </ul>
    {% else %}
        {{ show_footer(comments) }}
    {% endif %}
{% endmacro %}


{% macro test_show(comments) %}
    <ul class="list-group">
        <li class="list-group-item">
            <div class="panel panel-default">
                <ul class="list-group">
                    <li class="list-group-item">
                        <div class="panel-heading">
                            <label class="text-primary">1</label> 说 ：
                            <span class='pull-right text-muted h6'>评论日期：121212</span>
                        </div>
                        <div class="panel-body">asdfasfsaf
                            <a class="pull-right" data-toggle="modal"
                               data-target="#exampleModal"
                               data-whatever="1|23">回复</a>
                        </div>
                        <div class="panel panel-default">
                            <ul class="list-group">
                                <li class="list-group-item">
                                    <label class="text-primary">1</label> 说 ：
                                    <span class='pull-right text-muted h6'>评论日期：121212</span>

                                    <div class="panel-body">asdfasfsaf
                                        <a class="pull-right" data-toggle="modal"
                                           data-target="#exampleModal"
                                           data-whatever="1|23">回复</a>
                                    </div>
                                    <div class="panel panel-default">
                                        <ul class="list-group">
                                            <li class="list-group-item">
                                                <label class="text-primary">1</label> 说 ：
                                                <span class='pull-right text-muted h6'>评论日期：121212</span>

                                                <div class="panel-body">asdfasfsaf
                                                    <a class="pull-right" data-toggle="modal"
                                                       data-target="#exampleModal"
                                                       data-whatever="1|23">回复</a>
                                                </div>
                                            </li>
                                        </ul>
                                    </div>
                                </li>
                            </ul>
                        </div>
                    </li>
                </ul>
            </div>
        </li>
        <li class="list-group-item">
            <div class="panel panel-default">
                <ul class="list-group">
                    <li class="list-group-item">
                        <label class="text-primary">1</label> 说 ：
                        <span class='pull-right text-muted h6'>评论日期：121212</span>

                        <div class="panel-body">asdfasfsaf
                            <a class="pull-right" data-toggle="modal"
                               data-target="#exampleModal"
                               data-whatever="1|23">回复</a>
                        </div>
                    </li>
                </ul>
            </div>
        </li>
    </ul>
{% endmacro %}